﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net;



namespace ClientApplication
{
    /// <summary>
    /// Checks for messages of type one and if username and password finds a match,
    /// and that judge is not currently not in the list, adds the judge to currentConnections.
    /// </summary>
    public class Message
    {
        public String message { get; private set; } //Message from UDP-client
        public Judge judge { get; set; }
        public String type { get; set; }
        public Message(String message, IPEndPoint from)
        {
            //Expected message "messageType@username@password@
            String[] split = message.Split('@');
            this.message = split[2];
            this.judge = new Judge(split[1], from, "");
            this.type = split[0];
        }
    }
}
